package doc2jpg

import com.cmhk.uril.Watermark

class DocConvertController {
    def docConvertService

    def index() {

    }

    def doc2jpg(String docUrl) {
        def response = docConvertService.doc2jpg(docUrl, 'doc')
        def result = response.docConvertResponse.result
        def destDocAddr = response.docConvertResponse.destDocAddr
        [result: result, destDocAddr: destDocAddr]
    }

    def watermark(String srcImgUrl) {
        if (srcImgUrl) {
            response.setContentType("image/jpeg")
            response.setHeader("Content-disposition", "attachment;filename=1.jpg")
//        response.setContentLength(attach.size.toInteger())
            Watermark.markByText(["18018726608", "徐国统", "xgt@cmhk.com"] as String[], srcImgUrl, -10, response.outputStream)
        }

    }
}
